home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / OutlinerEdMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  7.4 KB  |  248 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  20 Aug 1996
  22. // Author:         jb
  23. //
  24. //
  25. //  Procedure Name:
  26. //        OutlinerEdMenu
  27. //
  28. //  Description:
  29. //        Creates a popup menu for the outliner, that
  30. //        allows for control of outliner display
  31. //
  32. //  Input Arguments:
  33. //      Parent outliner.
  34. //
  35. //  Return Value:
  36. //      None.
  37. //
  38.  
  39. //
  40. //  Procedure Name:
  41. //      setOutlinerLongName
  42. //
  43. //  Description:
  44. //        Sets the Outliner long/short name flag
  45. //
  46. //  Input Arguments:
  47. //      state - 0 = short, 1 = nice, 2 = long
  48. //
  49. //  Return Value:
  50. //      None.
  51. //
  52. global proc setOutlinerLongName (int $state, string $outlineEd)
  53. {
  54.     //    Query the current "name" state of the outliner.
  55.     //
  56.     int $longNames = `outlinerEditor -query -longNames $outlineEd`;
  57.     int $niceNames = `outlinerEditor -query -niceNames $outlineEd`;
  58.  
  59.     //    Check for a change.
  60.     //
  61.     if ($niceNames && $state == 1) return;
  62.     if (!$niceNames && $longNames && $state == 2) return;
  63.     if (!$niceNames && !$longNames && $state == 0) return;
  64.  
  65.     if( $state == 2 ) {
  66.         outlinerEditor -e -ln true -nn false $outlineEd;
  67.     } else if( $state == 1 ) {
  68.         outlinerEditor -e -ln true -nn true $outlineEd;
  69.     } else {
  70.         outlinerEditor -e -ln false -nn false $outlineEd;
  71.     }
  72. }
  73.  
  74. global proc OutlinerEdMenuCommand (string $outlineEd)
  75. {
  76.     //
  77.     // This is the post command for the Outliner Editor popup menu
  78.     
  79.     setParent -m ($outlineEd+"Popup");
  80.     menuItem -edit
  81.         -checkBox `outlinerEditor -query -showDagOnly $outlineEd`
  82.         dagItem;
  83.     menuItem -edit
  84.         -checkBox `outlinerEditor -query -showShapes $outlineEd`
  85.         shapeItem;
  86.     menuItem -edit
  87.         -checkBox `outlinerEditor -query -showAttributes $outlineEd`
  88.         attributeItem;
  89.     menuItem -edit
  90.         -checkBox `outlinerEditor -query -showSetMembers $outlineEd`
  91.         setMembersItem;
  92.     menuItem -edit
  93.         -checkBox `outlinerEditor -query -showConnected $outlineEd`
  94.         connectedItem;
  95.  
  96.     int $outlinerLongName = 1;
  97.     if (!`outlinerEditor -query -niceNames $outlineEd`) {
  98.         $outlinerLongName = (`outlinerEditor -query -longNames $outlineEd` ? 2 : 0);
  99.     }
  100.         menuItem -edit
  101.             -radioButton ( 1 == $outlinerLongName )
  102.             niceNameItem;
  103.         menuItem -edit
  104.             -radioButton ( 2 == $outlinerLongName )
  105.             longNameItem;
  106.         menuItem -edit
  107.             -radioButton ( 0 == $outlinerLongName )
  108.             shortNameItem;
  109.  
  110.     string $sortOrder = `outlinerEditor -query -sortOrder $outlineEd`;
  111.         menuItem -edit
  112.             -radioButton ($sortOrder == "none")
  113.             noneSortOrderItem;
  114.         menuItem -edit
  115.             -radioButton ($sortOrder == "dagName")
  116.             dagNameSortOrderItem;
  117. }
  118.  
  119. global proc OutlinerEdMenuUpdateDragStyle(string $menu,  string $outlineEd)
  120. {
  121.     setParent -m $menu;
  122.     menuItem -e -rb `outlinerEditor -q -dropIsParent $outlineEd` parentModeItem;
  123.     menuItem -e -rb (!`outlinerEditor -q -dropIsParent $outlineEd`) reorderModeItem;
  124. }
  125.  
  126. //
  127. //    procedure: switchOutlinerDropStyle
  128. //        switch in the outliner the drag/drop style
  129. //        keep in a global variable the state between different
  130. //        sessions
  131. //
  132. global proc  int switchOutlinerDropStyle (string $outlineEd)
  133. {
  134.     return (0);
  135. }
  136.  
  137. global proc OutlinerEdMenu (string $outlineEd)
  138. {
  139.  
  140.     popupMenu
  141.         -ctrlModifier false
  142.         -button 3
  143.         -postMenuCommand ("OutlinerEdMenuCommand " + $outlineEd)
  144.         -parent $outlineEd ($outlineEd+"Popup");
  145.  
  146.     menuItem -label "Show DAG Objects Only"
  147.         -checkBox true
  148.         -command ("outlinerEditor -edit -showDagOnly #1 " + $outlineEd)
  149.         dagItem;
  150.     menuItem -label "Show Shapes"
  151.         -checkBox false
  152.         -command ("outlinerEditor -edit -showShapes #1 " + $outlineEd)
  153.         shapeItem;
  154.     menuItem -label "Show Attributes"
  155.         -checkBox false
  156.         -command ("outlinerEditor -edit -showAttributes #1 " + $outlineEd)
  157.         attributeItem;
  158.     menuItem -label "Show Set Members"
  159.         -checkBox false
  160.         -command ("outlinerEditor -edit -showSetMembers #1 " + $outlineEd)
  161.         setMembersItem;
  162.     menuItem -label "Show Connected"
  163.         -checkBox false
  164.         -command ("outlinerEditor -edit -showConnected #1 " + $outlineEd)
  165.         connectedItem;
  166.     menuItem -divider true;
  167.     menuItem -label "Reveal Selected" 
  168.         -command ("outlinerEditor -edit -showSelected  1 " + $outlineEd)
  169.         showSelectedItem;
  170.     int $outlinerLongName = 1;
  171.     if (!`outlinerEditor -query -niceNames $outlineEd`) {
  172.         $outlinerLongName = (`outlinerEditor -query -longNames $outlineEd` ? 2 : 0);
  173.     }
  174.     menuItem -l "Channel Names" -subMenu true;
  175.         radioMenuItemCollection;
  176.         menuItem -l "Nice"
  177.             -radioButton ( 1 == $outlinerLongName )
  178.             -command ("setOutlinerLongName 1 " + $outlineEd)
  179.             niceNameItem;
  180.         menuItem -l "Long"
  181.             -radioButton ( 2 == $outlinerLongName )
  182.             -command ("setOutlinerLongName 2 " + $outlineEd)
  183.             longNameItem;
  184.         menuItem -l "Short"
  185.             -radioButton ( 0 == $outlinerLongName )
  186.             -command ("setOutlinerLongName 0 " + $outlineEd)
  187.             shortNameItem;
  188.         setParent -m ..;
  189.     string $sortOrder = `outlinerEditor -query -sortOrder $outlineEd`;
  190.     menuItem -l "Sort Order" -subMenu true;
  191.         radioMenuItemCollection;
  192.         menuItem -l "Scene Hierarchy"
  193.             -radioButton ($sortOrder == "none")
  194.             -command ("outlinerEditor -edit -sortOrder none " + $outlineEd)
  195.             noneSortOrderItem;
  196.         menuItem -l "Alphabetical Within Type"
  197.             -radioButton ($sortOrder == "dagName")
  198.             -command ("outlinerEditor -edit -sortOrder dagName " + $outlineEd)
  199.             dagNameSortOrderItem;
  200.         setParent -m ..;
  201.     menuItem -divider true;
  202.     menuItem -l "Select Set Members"
  203.         -command ("selectAllSetMembers " + $outlineEd)
  204.         selectAllSetMembersItem;
  205.     menuItem -divider true;
  206. }
  207.  
  208. global proc selectAllSetMembers (string $outliner)
  209. //
  210. //  Procedure Name:
  211. //      selectAllSetMembers
  212. //
  213. //  Description:
  214. //      For each set that is selected (gray) in the given Outliner editor,
  215. //    the members of that set are added to the selection list.
  216. //    The sets themselves are not added to the selection list, and will
  217. //    be deselected.
  218. //
  219. //  Input Arguments:
  220. //      The Outliner to get the list of selected sets from.
  221. //
  222. //  Return Value:
  223. //      None.
  224. //
  225.  
  226.  
  227. {
  228.     //  Get the selection connection that the given Outliner is using,
  229.     //  and get a list of all it's members.
  230.     //
  231.     string $outlinerSelection = `outlinerEditor -query -selectionConnection $outliner`;
  232.     string $selectedObjects[] = `selectionConnection -query -object $outlinerSelection`;
  233.  
  234.     string $currentObject;
  235.  
  236.     for($currentObject in $selectedObjects) { 
  237.  
  238.         //  If the selected object is a set (a node of type objectSet),
  239.         //  then make sure it is deselected and then select its contents instead.
  240.         //
  241.         if(`nodeType $currentObject` == "objectSet") {
  242.             select -noExpand -deselect $currentObject;
  243.             select -add $currentObject;
  244.         }
  245.     }
  246. }
  247.  
  248.